package com.kgc.edu;

import org.junit.Test;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;


public class test11 {
    @Test
        public  void charAtReverse (){
            String s="abc";
            int length = s.length();
            String reverse = "";
            for (int i = 0; i < length; i++) {
                reverse = s.charAt(i)+reverse;//字符串中获取单个字符的字符的放法
            }
        System.out.println(reverse);
        }


    @Test
    public void testInput(){
        try {
            FileInputStream fi=new FileInputStream("D:\\txt\\a.txt");
            FileOutputStream fo=new FileOutputStream("D:\\txt\\b.txt");
            byte[] bytes=new byte[1024];
            int len;
            while ((len=fi.read(bytes))!=-1){
                fo.write(bytes,0,len);
            };
            fi.close();
            fo.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }

    }

}
